<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="${res}/js/jquery/jquery.form.js"></script>
<script type="text/javascript" src="${res}/js/proposal/irisPrpPrepare.js"></script>
<script type="text/javascript" src="${res_app}/js/app/proposal/irisPrpPrepare.js"></script>
<script type="text/javascript" src="${res}/js/validate/irisvalidator.js"></script>
<title></title>
<%@ include file="/common/meta.jsp"%>
</head>
<body>
	<input type="hidden" id="childDiv" class="thickbox" />
	<form method="post" id="mainForm">
		<input type="hidden" id="prpCodes" name="prpCodes" value="" />
		<input type="hidden" id="type" name="type" value="" />
	</form>
	<div class="soBox">
		<div class="detail ico_search">
			<table>
				<tr>
					<td>
						<strong>检索条件：</strong>
					</td>
					<td>
						<cpt:search key="orgRecommendLimit_search" repeatColumn="3" displayCount="3" leftStyle="width:80px" ></cpt:search>
					</td>
				</tr>
				<tr>
					<td>
						<div class="clear_h10"></div>
						<input type='button' id='searchBt' class="button_an" value='查询' />
					</td>
				</tr>
			</table>
		</div>
	</div>
	<div class="clear_h10"></div>
	<div>
		<div id='TopBarMnt'></div>
		<table id='dataGrid'></table>
		<div id='dataBar'></div>
	</div>
	<script type="text/javascript">
    var irisGrid = new IrisGrid("dataGrid", "dataBar", 'TopBarMnt');
    var prcWin = new progressWin("${res}"); //初始化遮罩层
    /**
    * 表格初始化
    */
    function buildGrid() {
        
        var columnAttrList = new Array();
        var columnAttr = new ColumnAttr("业务年度", "stat_year","stat_year", 2, "center", true);
        columnAttrList.push(columnAttr);
        
        columnAttr = new ColumnAttr("计划类别", "plan_name","plan_name", 2, "center", true);
        columnAttrList.push(columnAttr);
      
        columnAttr = new ColumnAttr("项目类别", "grant_name","grant_name", 2, "center", true);
        columnAttrList.push(columnAttr);
      
        columnAttr = new ColumnAttr("归口管理部门", "recommend_org","recommend_org", 2, "center", true);
        columnAttrList.push(columnAttr);
      
       /*  columnAttr = new ColumnAttr("管理处室", "office_name","office_name", 3, "center", true);
        columnAttrList.push(columnAttr); */
      
        columnAttr = new ColumnAttr("申报批次", "batch","batch", 1, "center", true);
        columnAttrList.push(columnAttr);
      
        columnAttr = new ColumnAttr("最多可推荐个数", "limit_num","limit_num", 2, "center", true);
        columnAttrList.push(columnAttr);
        columnAttr = new ColumnAttr("已推荐个数", "recommend_num","recommend_num", 2, "center", true);
        columnAttrList.push(columnAttr);
        columnAttr = new ColumnAttr("剩余推荐个数", "rest_num","rest_num", 2, "center", true);
        columnAttrList.push(columnAttr);
        
        irisGrid.setColumnAttrs(columnAttrList);

        
        irisGrid.setUrl("${ctx}/prpapprove/listOrgRecommends"); //查询url
        irisGrid.setCaption("推荐情况表");
        irisGrid.setDefaultSortName("NLSSORT(stat_year,'NLS_SORT = SCHINESE_PINYIN_M') asc,NLSSORT(plan_name,'NLS_SORT = SCHINESE_PINYIN_M') asc,NLSSORT(grant_name,'NLS_SORT = SCHINESE_PINYIN_M') asc,NLSSORT(recommend_org,'NLS_SORT = SCHINESE_PINYIN_M')");//默认排序字段
        irisGrid.setDefaultSortorder("asc");
        irisGrid.setWidth(978); //整个表格宽度
        irisGrid.setLazyLoad(true);
        irisGrid.setCheckAble(false); //表格左边是否要复选框
        irisGrid.setShowRowIndex(true); //是否显示行号
        irisGrid.setCanExportExcel(true);
        irisGrid.setQueryBox('searchBt', 'orgRecommendLimit_search', []); //查询条件 按钮名，查询条件function_key
     
        irisGrid.build();
        }
    
    function edit(grantCode,orgCode,statYear,batch) {
      tb_show("编辑限项",ctx+'/prpapprove/editOrgRecommendLimit?type=edit&grantCode=' + grantCode+'&orgCode='+ orgCode+'&statYear='+ statYear+'&batch='+ batch+ '&TB_iframe=true&height=220&width=700');
      $(parent.document).find("#TB_ajaxWindowTitle").text("编辑限项");
    }
    
    function add() {
        tb_show("新增限项",ctx+'/prpapprove/addOrgRecommendLimit?type=add&TB_iframe=true&height=220&width=700');
        $(parent.document).find("#TB_ajaxWindowTitle").text("新增限项");
    }
    
    /**
    * 页面加载完毕初始化函数
    */
    $(function(){
        buildGrid();
        $("div[class*='ui-jqgrid-bdiv']").css("overflow","hidden");
        $("#TopBarMnt").css("width","971px");
        $("#cb_dataGrid").click(function(){
            var checked=$(this).attr("checked");
            if(checked=="checked"){
                $("#dataGrid").find("td input[type='checkbox']").attr("checked","checked");
                $("#dataGrid").find("tr[class*='jqgrow']").each(function(){
                    if($(this).find("td input[type='checkbox']").length<=0){
                        $(this).removeClass("ui-state-highlight");
                    }
                });
                
            }else{
                $("#dataGrid").find("td input[type='checkbox']").attr("checked",false);
            }
        });
    });
    </script>
</body>
</html>
<script type="text/javascript">
  
</script>